<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // let [a,b,c,[d,e,f]] = [1,2,3,[4,5,6]];

        // // console.log(a,b,c,d);

        // let arr2 = [a,b,c,d,e,f];

        // console.log(arr2);

        // let arr = [1,2,3,[4,5,6]];

        // 默认值为1 拉平一层
        // let arr2 = arr.flat();
        // console.log(arr2);

        
        // let arr = [1,2,3,[4,5,[6,7,8]]];
        // 拉平2层
        // let arr2 = arr.flat(2);
        // console.log(arr2);

        
        let arr = [1,2,3,[4,5,[6,7,[9,[10,[111]]],8]]];
        // 无限拉平
        let arr2 = arr.flat(Infinity);

        console.log(arr2);

        

    </script>
</body>
</html>